package com.lnkj.spcj.widget

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter


/**
 * Copyright (c) 山东六牛网络科技有限公司 https://liuniukeji.com
 *
 * @Description
 * @Author         与天同行的观测者
 * @Copyright      Copyright (c) 山东六牛网络科技有限公司 保留所有版权(https://www.liuniukeji.com)
 * @Date           $date$ $time$
 */
class CustomFragmentPagerAdapter2(var titles: Array<String>?, var mFragments: Array<Fragment>?, var fragmentManager: FragmentManager) : FragmentPagerAdapter(fragmentManager) {
    override fun getItem(position: Int): Fragment {
        return mFragments!![position]
    }

    override fun getCount(): Int {
        return mFragments!!.size
    }

    override fun getItemId(position: Int): Long {
        // 获取当前数据的hashCode
        val hashCode = titles?.get(position)?.hashCode()
        return hashCode?.toLong() ?: 0
    }
}